package com.ld.security.common.shiro.realm;

import com.ld.security.common.shiro.model.AccountModel;
import com.ld.security.common.shiro.model.PermissionModel;
import com.ld.security.common.shiro.model.RoleModel;
import com.ld.security.common.shiro.service.BaseAuthService;
import com.ld.security.common.shiro.service.PasswordAuthService;
import com.ld.security.common.shiro.vo.UserInfo;
import org.apache.shiro.authc.*;
import org.apache.shiro.authc.credential.PasswordService;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection;

public class PasswordRealm extends BaseAuthRealm {



    @Override
    public Class<?> getAuthenticationTokenClass() {
        return UsernamePasswordToken.class;
    }

    @Override
    protected String getUsername(AuthenticationToken authenticationToken) {
        return authenticationToken.getPrincipal().toString();
    }

    @Override
    protected String getUsername(PrincipalCollection principalCollection) {
        return principalCollection.getPrimaryPrincipal().toString();
    }
}
